import { stringify } from 'qs';
import request from '@/utils/request';

import webpath from '@/utils/webpath';

export async function deleteByPrimaryKeyForProPost(params = {}) {
    return request(`/${webpath}/web/api/service/post/delete?${stringify(params)}`);
}


export async function selectByPrimaryKeyForProDept(params = {}) {
    return request(`/${webpath}/web/api/service/prodept/get?${stringify(params)}`);
}


export async function insertForProPost(params = {}) {
    return request(`/${webpath}/web/api/service/post/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}


export async function updateForProPost(params = {}) {
    return request(`/${webpath}/web/api/service/post/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}


export async function deleteByMapForProDept(params = {}) {
    return request(`/${webpath}/web/api/service/prodept/deleteByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete',
        },
    });
}


export async function updateByMapForProDept(params = {}) {
    return request(`/${webpath}/web/api/service/prodept/updateByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}


export async function getOneForProDept(params = {}) {
    return request(`/${webpath}/web/api/service/prodept/getOne`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}



export async function getAllForProDept(params = {}) {
    return request(`/${webpath}/web/api/service/prodept/getAll`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function queryPageForProPost(params = {}) {
    return request(`/${webpath}/web/api/service/post/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function countForProDept(params = {}) {
    return request(`/${webpath}/web/api/service/prodept/count`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function insertBatchForProDept(params = {}) {
    return request(`/${webpath}/web/api/service/prodept/insertBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}


export async function deleteBatchForProDept(params = {}) {
    return request(`/${webpath}/web/api/service/prodept/deleteBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete',
        },
    });
}


export async function updateBatchForProDept(params = {}) {
    return request(`/${webpath}/web/api/service/prodept/updateBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}

export async function getProDeptTreeByParentid(params = {}) {
    return request(`/${webpath}/web/api/service/prodept/getProDeptTreeByParentid`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}